package com.sansui.blog.controller.admin.page;

import com.sansui.blog.dao.SysInfoDao;
import com.sansui.blog.service.ThemesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @name: ThemesController
 * @author: Sansui
 * @Software: IDEA
 * @Blog: https://www.cnblogs.com/sansui6/
 * @date: 2022-08-04 22:20
 **/

//主题管理
@Controller
@RequestMapping("/admin")
public class ThemesController {

    @Autowired
    private ThemesService themesService;

    //  打开主题管理页面
    @GetMapping("page/themes")
    public String themes(){
        return "admin/page/themes";
    }


    @GetMapping("page/getThemesList")
    @ResponseBody
    public Map<String, Object> getThemesList(){
        Map<String, Object> map = themesService.getThemesList();
        return map;
    }


    /**
     * 系统更新使用的主题
     * @param themeId
     * @return
     */
    @PostMapping("page/updateThemes")
    @ResponseBody
    public Map<String, Object> updateThemes(Long themeId){
        System.out.println(themeId);
        Map<String, Object> map = themesService.updateThemes(themeId);
        return map;
    }

}
